home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / groupwar / _winfile / gp_ease / setup.mst < prev    next >
Text File  |  1995-01-14  |  6KB  |  203 lines

  1. '$DEFINE DEBUG  ''Define for script development/debugging
  2.  
  3. '$INCLUDE 'setupapi.inc'
  4. '$INCLUDE 'msdetect.inc'
  5.  
  6. '' This lets us add progman items
  7.  
  8. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  9. DECLARE FUNCTION UpdateAutoExec LIB "Setup.dll" (PATH$) AS INTEGER
  10. DECLARE FUNCTION IsGroupEaseRunning LIB "Setup.dll" AS INTEGER
  11.  
  12. ''Dialog ID's
  13. CONST ASKQUIT       = 200
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST EXITSUCCESSRB = 701
  19. CONST APPHELP       = 900
  20. CONST MODELESS      = 5000
  21. CONST BADPATH       = 6400
  22.  
  23.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  24.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  25.  
  26.     '' Display the logo bitmap
  27.     SetBitmap CUIDLL$, 1
  28.  
  29.     '' read the .INF file
  30.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  31.     ReadInfFile szInf$
  32.  
  33.     '' Make sure the GroupEase is not running first 
  34.     i%=IsGroupEaseRunning()
  35.     IF i% <> 0 THEN
  36.       i% = DoMsgBox ("GroupEase must not be running during Setup.  Please exit GroupEase then restart Setup.", "Setup", 0)
  37.       END
  38.     END IF
  39.  
  40.     '' query user for location to install to
  41.     DEST$="c:\ge"   ''default destination
  42.  
  43. GETPATH:
  44.     SetSymbolValue "EditTextIn", DEST$
  45.     SetSymbolValue "EditFocus", "END"
  46. GETPATHL1:
  47.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  48.     DEST$ = GetSymbolValue("EditTextOut")
  49.  
  50.     IF sz$ = "CONTINUE" THEN
  51.         IF IsDirWritable(DEST$) = 0 THEN
  52.             GOSUB BADPATH
  53.             GOTO GETPATHL1
  54.         END IF
  55.         UIPop 1
  56.     ELSEIF sz$ = "REACTIVATE" THEN
  57.         GOTO GETPATHL1
  58.     ELSEIF sz$ = "BACK" THEN
  59.         GOTO GETPATHL1
  60.     ELSE
  61.         GOSUB ASKQUIT
  62.         GOTO GETPATH
  63.     END IF
  64.  
  65.  
  66.  
  67.     '' specify which files from .INF file should get copied
  68.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  69.  
  70.     '' Get the application GroupEase and associated stuff
  71.     AddSectionFilesToCopyList "GroupEase", SrcDir$, DEST$
  72.  
  73.     '' Make sure there is available disk space
  74.     '' First param is just left as "extra", because we are not
  75.     '' expanding any existing files (i.e. adding a K or two to the 
  76.     '' WIN.INI file. If you use this, add an "Extra" symbol to
  77.     '' the symbol table created by AddListitem.
  78.     '' Second Parameter identifies a symbol table that the
  79.     '' GetCopyListCost function will create for how much space
  80.     '' is used by the files to be copied to hard disk.
  81.     '' Third Parameter identifies a symbol table that the
  82.     '' GetCopyListCost function will create to identify needed
  83.     '' disk space.
  84.  
  85.     lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
  86.  
  87.     IF lRetVal& > 0 THEN
  88.       i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
  89.       ClearCopyList
  90.       GOTO GETPATH '' Try another directory
  91.     END IF
  92.  
  93.     AddToBillboardList CUIDLL$, MODELESS, "FModelessDlgProc", 1
  94.  
  95.     SetCopyGaugePosition 100, 100
  96.  
  97.     '' copy the files
  98.     CopyFilesInCopyList
  99.  
  100.     '' Get the .INI files
  101.     AddSectionFilesToCopyList "INIs", SrcDir$, GetWindowsDir()
  102.     SetCopyGaugePosition 100, 100
  103.     CopyFilesInCopyList
  104.  
  105.     '' Get the Windows files
  106.     AddSectionFilesToCopyList "Windows", SrcDir$, GetWindowsDir()
  107.     SetCopyGaugePosition 100, 100
  108.     CopyFilesInCopyList
  109.  
  110.     '' create a progman group
  111.     CreateProgmanGroup "Ethosoft", "", cmoNone
  112.     ShowProgmanGroup  "Ethosoft", 1, cmoNone
  113.     CreateProgmanItem "Ethosoft", "GroupEase", MakePath(DEST$,"ge.exe"), "", cmoOverwrite
  114.     CreateProgmanItem "Ethosoft", "CardData Converter", MakePath(DEST$,"cdfconv.exe"), "", cmoOverwrite
  115.     CreateProgmanItem "Ethosoft", "UserName Mapper", MakePath(DEST$,"usrname.exe"), "", cmoOverwrite
  116.     CreateProgmanItem "Ethosoft", "Read Me", MakePath(DEST$,"readme.wri"), "", cmoOverwrite
  117.  
  118.     '' add the Sounds to the WIN.INI section
  119.     CreateIniKeyValue "WIN.INI", "Sounds", "GroupEaseRing", MakePath(DEST$,"GERING.WAV,GroupEase Ring"), cmoNone
  120.     CreateIniKeyValue "WIN.INI", "Sounds", "GroupEaseAlarm", MakePath(DEST$,"GEALRM.WAV,GroupEase Alarm"), cmoNone
  121.  
  122.     '' add our directory to the path if it is not already there
  123.     '' note: return values:
  124.     '' < 0 means error trying
  125.     '' = 0 means path added to autoexec.bat
  126.     '' > 0 means path already had ours in it
  127.     i%=UpdateAutoExec(DEST$)
  128.     IF i% < 0 THEN
  129.       ERR=i%
  130.     ENDIF
  131.  
  132. QUIT:
  133.     ON ERROR GOTO ERRQUIT
  134.  
  135.     IF ERR = 0 THEN
  136.         IF i% = 0 THEN
  137.           dlg% = EXITSUCCESSRB
  138.         ELSE
  139.           dlg% = EXITSUCCESS
  140.         ENDIF
  141.     ELSEIF ERR = STFQUIT THEN
  142.         dlg% = EXITQUIT
  143.     ELSE
  144.         dlg% = EXITFAILURE
  145.     END IF
  146. QUITL1:
  147.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  148.     IF sz$ = "REACTIVATE" THEN
  149.         GOTO QUITL1
  150.     END IF
  151.     UIPop 1
  152.  
  153.     END
  154.  
  155. ERRQUIT:
  156.     i% = DoMsgBox("Setup sources were corrupted, call Ethosoft customer support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  157.     END
  158.  
  159. BADPATH:
  160.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  161.     IF sz$ = "REACTIVATE" THEN
  162.         GOTO BADPATH
  163.     END IF
  164.     UIPop 1
  165.     RETURN
  166.  
  167. ASKQUIT:
  168.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  169.  
  170.     IF sz$ = "EXIT" THEN
  171.         UIPopAll
  172.         ERROR STFQUIT
  173.     ELSEIF sz$ = "REACTIVATE" THEN
  174.         GOTO ASKQUIT
  175.     ELSE
  176.         UIPop 1
  177.     END IF
  178.     RETURN
  179.  
  180. '*************************************************************************
  181. '**
  182. '** Purpose:
  183. '**     Appends a file name to the end of a directory path,
  184. '**     inserting a backslash character as needed.
  185. '** Arguments:
  186. '**     szDir$  - full directory path (with optional ending "\")
  187. '**     szFile$ - filename to append to directory
  188. '** Returns:
  189. '**     Resulting fully qualified path name.
  190. '*************************************************************************
  191. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  192.     IF szDir$ = "" THEN
  193.         MakePath = szFile$
  194.     ELSEIF szFile$ = "" THEN
  195.         MakePath = szDir$
  196.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  197.         MakePath = szDir$ + szFile$
  198.     ELSE
  199.         MakePath = szDir$ + "\" + szFile$
  200.     END IF
  201. END FUNCTION
  202.  
  203.